﻿using System;
using System.Text;
using System.Collections.Generic;
using System.Linq;
using Microsoft.VisualStudio.TestTools.UnitTesting;

namespace Expect.Core.Test
{
    using Expect.Core.BaseClasses;
    using Expect.Core.IO;
    using Expect.Core.Test.IO;
    using Expect.Core.Test.Fixtures;

    [TestClass]
    public class ComplexSpecTest
    {
        [TestMethod]
        public void ComplexSpec_Run ()
        {
            var spec = SampleSpecificationCheck.ReadSpecification(new TextSpecificationReader(), "ComplexSpec.txt");
            spec.Context = new DefaultExecutionContext() { Container = this };
            spec.Run();

            if ((spec.Status.Success.HasValue == false))
            {
                Assert.Inconclusive(spec.GetMessageForInconclusiveResult());
            }
            if ((spec.Status.Success.Value == false))
            {
                Assert.Fail(spec.GetMessageForFailedResult());
            }
        }

        public void MaDeviseEst(string devise)
        {
            Assert.AreEqual("EUR", devise);
        }

        public void LesFraisDePortSontDe(Price montantFraisDePort)
        {
            Assert.AreEqual("EUR", montantFraisDePort.Devise);
            Assert.AreEqual(5, montantFraisDePort.Montant);
        }

        [FixtureHint("Si j'ajoute |*| produit |*|")]
        public void AMethodWithAlias(int quantite, string codeurl)
        {
            Assert.AreEqual(1, quantite);
            Assert.AreEqual("test-url", codeurl);
        }

        public void SiJEnleveLeProduitDuPanier(string codeurl)
        {
            
        }

        public void MonPanierDoitContenir(FixtureData data)
        {
            Assert.AreEqual("autre-url", data[0]["Code url"]);
            Assert.AreEqual("Un autre produit", data[0]["Nom"]);
            Assert.AreEqual("2", data[0]["Quantité"]);
            Assert.AreEqual("30 EUR", data[0]["Prix"]);
        }

        public void UnTestDeMethodeEt(string prm1, string prm2, FixtureData data)
        {
            Assert.AreEqual("avec fixture data", prm1);
            Assert.AreEqual("paramètres", prm2);
            Assert.AreEqual(2, data.Count);
            Assert.AreEqual("1", data[0]["Test"]);
            Assert.AreEqual("ABCD", data[0]["valeur"]);
            Assert.AreEqual("3", data[1]["Test"]);
            Assert.AreEqual("EFGH", data[1]["valeur"]);
            int nb = data.Count;
        }
    }
}
